/*
  Copyright (c) 2014 Dimitrij Gester

  "Smart RC TX" is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  "Smart RC TX" is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General
  Public License along with "Smart RC TX"; if not, write to the
  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  Boston, MA  02111-1307  USA
*/


#ifndef SERIALPERSISTOR_H
#define SERIALPERSISTOR_H

#include <Arduino.h>
#include "MixerPersistor.h"
#include <Stream.h>
#include "stdio.h"

class SerialPersistor : public MixerPersistor
{
public:
	SerialPersistor(Stream &s)
	: MixerPersistor()
	, serial(s)
	, count(0)
	{}
	
	void putValue(int16_t v)
	{
		//uint8_t h, l;
		//h = v >> 8;
		//l = v & 0xff;
				
		serial.print(count++);
		serial.print(": ");
		// serial.print(h, HEX);
		// serial.println(l, HEX);
		serial.println(v);
	}
	
	bool hasValue()
	{
		return false;
	}
	
	virtual int16_t getValue()
	{
		return 0;
	}
	
private:
	Stream &serial;
	uint16_t count;
};
#endif


